How to Use the HTML iframe Tag with Examples
This Blog You Will Learn
ஃ what is the <iframe> tag?
ஃ Why Use the <iframe> Tag ?
ஃ Important <iframe> Attributes
ஃ Syntax of HTML <iframe> tag
ஃ Explain Program
ஃ Output
what is the <iframe> tag?
✅ HTML <iframe> tag used to embed another webpage
✅ <iframe> tag external content inside a webpage.
✅ <iframe> tag stands for lnline frame.
✅ use embed an external document or webpage within the current HTML document.
✅ HTML <iframe> tag use to display another webpage or external content inside a webpage.
✅ <iframe> tag use display content such as maps,videos,documents websites.
Why Use the <iframe> Tag ?
✔ Display external websites.
✔ Embed YouTube videos.
✔ Show Google Maps.
✔ Load third-party content.
Advantages of <iframe> tag
- Easy to embed external content.
- keep users on your page.
- Save development time.
Important <iframe> Attributes
1) src (source)
specifies URL of webpage or content to be embedded inside the <iframe> tag.
2) width
Defines the width of the <iframe> tag
3) height
Defines the height of the iframe
4) title
text description of the iframe for screen readers.
5) allowfullscreen
Allows embedded content (like videos) fullscreen
6) loading
controls how the iframe is loaded.
values:-
lazy - loads only when needed
eager - loads immediately
7) sandbox ( security attribute)
adds security restrictions to the frame content.
8) referrerpolicy
controls what referrer information is sent
improves privacy and security
9) allow
controls access to browser features (camera microphone etc)
Syntax of HTML <iframe> tag
.
.
- <iframe> tag in HTML use to embed another webpage or external content inside webpage.
- HTML <iframe> tag inline frame tag.
- HTML <iframe> tag allows display separate html page small window on your current page.
- HTML <iframe> tag embed example :- YouTube videos, Ads, webpages, Twitter, TikTok video, Pinterest Pin ,Facebook
How to Use the HTML iframe Tag with Examples
Example
How to Use the HTML iframe Tag with Examples
Explain Program
Step 1]
<!DOCTYPE html>
- This declare the document type.
- browser that the document is written in html
Step 2 ]
<html>.... . </html>
- html is the root element of the html page.
- Every thing inside it is part of the webpage.
Step 3]
- <head> section
- head section contains metadata about page. not visible on the page itself.
- <title> tag title section set the title of the page shows the browser tab.
Step 4]
<body>
- < body> tag contains all the content visible to webpage.
- <body> tag contains all the visible content of the page.
- inside <body> show the browser screen.
Step 5]
- <h1> tag heading tag use for main title on webpage .
- <h2> tag subheading of page.
Step 6]
- <iframe>.....</iframe>
- The iframe tag is use to embed another webpage inside webpage.
- title :- provides text description of iframe content.
- helps seo browser understanding.
Step 7]
closing the Tag
